﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.BlendState
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Values for the blend state.</para>
  /// </summary>
  /// <summary>
  ///   <para>Creates a new blend state with the specified values.</para>
  /// </summary>
  /// <param name="separateMRTBlend">Determines whether each render target uses a separate blend state.</param>
  /// <param name="alphaToMask">Turns on alpha-to-coverage.</param>
  public struct BlendState(bool separateMRTBlend = false, bool alphaToMask = false) : 
    IEquatable<BlendState>
  {
    private RenderTargetBlendState m_BlendState0 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState1 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState2 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState3 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState4 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState5 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState6 = RenderTargetBlendState.defaultValue;
    private RenderTargetBlendState m_BlendState7 = RenderTargetBlendState.defaultValue;
    private byte m_SeparateMRTBlendStates = Convert.ToByte(separateMRTBlend);
    private byte m_AlphaToMask = Convert.ToByte(alphaToMask);
    private short m_Padding = 0;

    /// <summary>
    ///   <para>Default values for the blend state.</para>
    /// </summary>
    public static BlendState defaultValue => new BlendState();

    /// <summary>
    ///   <para>Determines whether each render target uses a separate blend state.</para>
    /// </summary>
    public bool separateMRTBlendStates
    {
      get => Convert.ToBoolean(this.m_SeparateMRTBlendStates);
      set => this.m_SeparateMRTBlendStates = Convert.ToByte(value);
    }

    /// <summary>
    ///   <para>Turns on alpha-to-coverage.</para>
    /// </summary>
    public bool alphaToMask
    {
      get => Convert.ToBoolean(this.m_AlphaToMask);
      set => this.m_AlphaToMask = Convert.ToByte(value);
    }

    /// <summary>
    ///   <para>Blend state for render target 0.</para>
    /// </summary>
    public RenderTargetBlendState blendState0
    {
      get => this.m_BlendState0;
      set => this.m_BlendState0 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 1.</para>
    /// </summary>
    public RenderTargetBlendState blendState1
    {
      get => this.m_BlendState1;
      set => this.m_BlendState1 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 2.</para>
    /// </summary>
    public RenderTargetBlendState blendState2
    {
      get => this.m_BlendState2;
      set => this.m_BlendState2 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 3.</para>
    /// </summary>
    public RenderTargetBlendState blendState3
    {
      get => this.m_BlendState3;
      set => this.m_BlendState3 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 4.</para>
    /// </summary>
    public RenderTargetBlendState blendState4
    {
      get => this.m_BlendState4;
      set => this.m_BlendState4 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 5.</para>
    /// </summary>
    public RenderTargetBlendState blendState5
    {
      get => this.m_BlendState5;
      set => this.m_BlendState5 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 6.</para>
    /// </summary>
    public RenderTargetBlendState blendState6
    {
      get => this.m_BlendState6;
      set => this.m_BlendState6 = value;
    }

    /// <summary>
    ///   <para>Blend state for render target 7.</para>
    /// </summary>
    public RenderTargetBlendState blendState7
    {
      get => this.m_BlendState7;
      set => this.m_BlendState7 = value;
    }

    public bool Equals(BlendState other)
    {
      return this.m_BlendState0.Equals(other.m_BlendState0) && this.m_BlendState1.Equals(other.m_BlendState1) && this.m_BlendState2.Equals(other.m_BlendState2) && this.m_BlendState3.Equals(other.m_BlendState3) && this.m_BlendState4.Equals(other.m_BlendState4) && this.m_BlendState5.Equals(other.m_BlendState5) && this.m_BlendState6.Equals(other.m_BlendState6) && this.m_BlendState7.Equals(other.m_BlendState7) && (int) this.m_SeparateMRTBlendStates == (int) other.m_SeparateMRTBlendStates && (int) this.m_AlphaToMask == (int) other.m_AlphaToMask;
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is BlendState other && this.Equals(other);
    }

    public override int GetHashCode()
    {
      return ((((((((this.m_BlendState0.GetHashCode() * 397 ^ this.m_BlendState1.GetHashCode()) * 397 ^ this.m_BlendState2.GetHashCode()) * 397 ^ this.m_BlendState3.GetHashCode()) * 397 ^ this.m_BlendState4.GetHashCode()) * 397 ^ this.m_BlendState5.GetHashCode()) * 397 ^ this.m_BlendState6.GetHashCode()) * 397 ^ this.m_BlendState7.GetHashCode()) * 397 ^ this.m_SeparateMRTBlendStates.GetHashCode()) * 397 ^ this.m_AlphaToMask.GetHashCode();
    }

    public static bool operator ==(BlendState left, BlendState right) => left.Equals(right);

    public static bool operator !=(BlendState left, BlendState right) => !left.Equals(right);
  }
}
